using System.ComponentModel.DataAnnotations;
using SqlSugar;

namespace FytSoa.Domain.Hr;

/// <summary>
/// 离职档案
/// </summary>
[SugarTable("hr_dimission")]
public class HrDimission:Entity
{
    /// <summary>
    /// 离职员工
    /// </summary>
    [Required]
    public long EmployeeId { get; set; }
    
    /// <summary>
    /// 离职员工
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(EmployeeId))]
    public HrEmployee EmployeeObj { get; set; }

    /// <summary>
    /// 离职日期
    /// </summary>
    [Required]
    public DateTime DimissionTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 部门负责人
    /// </summary>
    [Required]
    public long LeaderId { get; set; }
    
    /// <summary>
    /// 离职员工
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(LeaderId))]
    public HrEmployee LeaderObj { get; set; }

    /// <summary>
    /// 交接人员
    /// </summary>
    [Required]
    [SugarColumn(IsJson = true)]
    public List<HandoverPerson> Handover { get; set; } = new();

    /// <summary>
    /// 是否完成
    /// </summary>
    public bool Status { get; set; } = false;

    /// <summary>
    /// 离职原因
    /// </summary>
    public string Reason { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 修改时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 交接人员集合
    /// </summary>
    public class HandoverPerson
    {
        /// <summary>
        /// 人员编号
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 人员姓名
        /// </summary>
        public string Name { get; set; }
    }
}